package com.iflytek.document;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;

@Data
@Document(indexName = "goods_info")
public class GoodsDocument {

    @Id
    @ApiModelProperty(value = "序号,新增不传", example = "1")
    private Long id;

    @Field(name = "name", type = FieldType.Text)
    @ApiModelProperty(value = "商品名称")
    private String name;

    @Field(name = "description", type = FieldType.Text)
    @ApiModelProperty(value = "商品描述")
    private String description;

    @Field(name = "no", type = FieldType.Text)
    @ApiModelProperty(value = "商品编号")
    private String no;

    @Field(name = "price", type = FieldType.Double)
    @ApiModelProperty(value = "原价")
    private BigDecimal price;

    @Field(name = "realPrice", type = FieldType.Double)
    @ApiModelProperty(value = "实际价格")
    private BigDecimal realPrice;

    @Field(name = "discount", type = FieldType.Double)
    @ApiModelProperty(value = "折扣")
    private Double discount;

    @Field(name = "store", type = FieldType.Integer)
    @ApiModelProperty(value = "库存", example = "1")
    private Integer store;

    @Field(name = "praise", type = FieldType.Integer)
    @ApiModelProperty(value = "点赞数", example = "1")
    private Integer praise;

    @Field(name = "sales", type = FieldType.Integer)
    @ApiModelProperty(value = "销量", example = "1")
    private Integer sales;

    @Field(name = "categoryId", type = FieldType.Long)
    @ApiModelProperty(value = "分类id", example = "1")
    private Long categoryId;

    @Field(name = "categoryName", type = FieldType.Text)
    @ApiModelProperty(value = "分类名称")
    private String categoryName;

    @Field(name = "imgs", type = FieldType.Text)
    @ApiModelProperty(value = "商品图片")
    private String imgs;

    @Field(name = "createTime", type = FieldType.Text)
    @ApiModelProperty(value = "创建时间")
    private String createTime;

    @Field(name = "recommend", type = FieldType.Boolean)
    @ApiModelProperty(value = "是否推荐：0不推荐，1推荐")
    private Boolean recommend;
}
